﻿@using MvcControls
@using MvcControls.Controls.Base
@using MvcControls.Controls.Button
@using MvcControls.Controls.Parameters
@using SDM.Domain.Models
@using SDM.Main.Areas.App.Views.Settings
@inherits WebViewPage<AccountModel>, ILocalizable<Texts>, ILocalizable<AccountModel.Texts>
@{
    var isAddMode = Model != null && Model.IsNew;
    ViewBag.Title = isAddMode ? this.Localize<Texts>(t => t.AddAccount) : this.Localize<Texts>(t => t.EditAccount);
}
@using (Html.BeginForm())
{
    <div>
        @Html.LabelFor(t => t.UserName, this.Localize<AccountModel.Texts>(t => t.UserName))
        @Html.TextBoxFor(t => t.UserName)
        @Html.ValidationMessageFor(t => t.UserName)
    </div>
    <div>
        @Html.LabelFor(t => t.Password, this.Localize<AccountModel.Texts>(t => t.Password))
        @Html.PasswordFor(t => t.Password)
        @Html.ValidationMessageFor(t => t.Password)
    </div>
    <div>
        <label>
        </label>
        <input type="password" name="password2" />
    </div>
    <div>
        @Html.LabelFor(t => t.IsAdmin, this.Localize<AccountModel.Texts>(t => t.IsAdmin))
        @Html.CheckBoxFor(t => t.IsAdmin)
    </div>
    <div>
        @Html.LabelFor(t => t.IsEnabled, this.Localize<AccountModel.Texts>(t => t.IsEnabled))
        @Html.CheckBoxFor(t => t.IsEnabled)
    </div>
    <div>
        @Html.Custom().Render((IHtmlControl)ViewBag.ResultMessage)
    </div>
    @Html.Custom().Button().Settings(s =>
                                         {
                                             s.Text = this.Localize<Texts>(t => isAddMode ? t.Shared.Add : t.Shared.Save);
                                             s.Type = ButtonControlInfo.ButtonType.Submit;
                                         })
    @Html.Custom().Button().Settings(s =>
                                         {
                                             s.Text = this.Localize<Texts>(t => t.Shared.Cancel);
                                             s.Action = new ActionParameter("System");
                                         })
}
